package day14;

import java.lang.reflect.Method;

/**
 * @author oldliu
 * @since 1.0
 */
public class CalcTest {
    public static void main(String[] args) throws Exception {
        Calc c=new Calc();
//        int add = c.add(10, 209);
//        System.out.println(add);
        Method m = c.getClass().getDeclaredMethod("takeAway", int.class, int.class);
        //m方法上是否存在一个MyTest的这个注解
        if(m.isAnnotationPresent(MyTest.class)){
            MyTest my = m.getAnnotation(MyTest.class);
            System.out.println(my.before());
            Object r = m.invoke(c, 10, 20);
            System.out.println("返回了："+r);
            System.out.println(my.after());
        }else{
            Object r = m.invoke(c, 10, 20);
            System.out.println("返回了："+r);
        }


    }
}
